<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/decorators/taglibs.jsp"%>
<div class="w1a">    
<div class="w2">會期資料 » 區間清單  </div>
<br/> 
<form:form modelAttribute="searchForm" id="searchForm" method="post" class="form" action="">   
	<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" > 
			<tr>
				<td align="right" width="45%"><label for="objective">單位：</label></td>
				<td> 
					<form:select path="unitCode" id="unitCode">
						<form:option value="" label=""/>
		            	<form:options items="${unitSource}" itemValue="code" itemLabel="name"/>
		        	</form:select>
				</td>
			</tr>
			<tr>
				<td align="right"><label for="objective">會期：</label></td>
				<td><form:input id="sessionNo" path="sessionNo" style="width:50px;"/>
				～<form:input id="sessionNo2" path="sessionNo2" style="width:50px;"/>
				</td>
			</tr>
			<tr>
				<td align="center" colspan="2">
					<a href="#do" class="easyui-linkbutton" onclick="doSearch()">查詢</a> 
					<a href="#do" class="easyui-linkbutton" onclick="fmClean()">清空</a>
					<a href="#do" class="easyui-linkbutton" onclick="exp($('#searchForm'))">匯出清單</a>
				</td>
			</tr>
	</table>				
</form:form>    
<table id="dg" class="easyui-datagrid" style="height:360px"  url="${appPath}/motion/list.json" align="center" 
	singleSelect="true" striped="true" title="區間清單" rownumbers="true" pagination="true" pageSize="20"
	sortName="motionNo" multiSort="true" sortable="true" sortOrder="desc"> 
	<thead>      
    	<tr>   
            <th field="session.sessionNo" width="50px" sortable="true" formatter="noFormat">會期</th>
            <th field="unitCode" width="40" >單位</th>
	        <th field="typeNo" width="40">案別</th>
	        <th field="provisional" width="40" formatter="provisional">臨時</th>
	        <th field="motionOrder" width="40" editor="text">案次</th>
	        <th field="inCharge" width="80" >承辦人</th>
	        <th field="sectionChief" width="80" >科長</th>
	        <th field="cause" width="600" >案由</th>
		</tr>   
	</thead>   
</table> 
</div>
<script type="text/javascript">
$(function() {
});
function doSearch(){ var object = {};
	$.each($('#searchForm').serializeArray(), function(i, v) { object[v.name] = v.value; });
	$('#dg').datagrid('load', object ); 
} 
function exp(formid){
	formid.form('submit', { url:'${appPath}/report/motionList.htm' });
}

function fmClean(){$("#searchForm").form('reset');}
function noFormat(val, row, ix){
	return row.session.sessionNo;
}
function provisional(val, row, ix) {
	return eval(val)?"✔":"";
}
</script>